import Vue from 'vue'
import VueRouter from 'vue-router'
// 导航条组件(主界面组件) 首页,目的地,发现,订单,我的
import Index from '@/views/Index'
// 目的地
import Bourn from './bourn.js'
// 发现
import Find from './find.js'
//订单
import Order from './order.js'
// 我的
import My from './my.js'
// 商品列表
import ProductList from './productList.js'
// 商品
import Merchant from './merchant.js'

// 搜索
import Search from './search.js'

//出发地(城市导航) 
import CityNav from './cityNav.js'







// url点击两次报错问题解决
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err);
};


Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/index'
  },
  {
    path: '/index',
    component: Index
  },
  Bourn,
  Find,
  Order,
  My,
  Search,
  CityNav,
  ProductList,
  Merchant,
]

const router = new VueRouter({
  routes
})

export default router
